Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

MengFanjun的博客

一、电路图

在这里插入图片描述

二、程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
int led=5;
int beep=8;
void setup() {
pinMode(beep,OUTPUT);
pinMode(led,OUTPUT);

}

void loop()
{
sos();
}
void sos()
{
for(int a=0;a<3;a++)
{
digitalWrite(beep,LOW);
digitalWrite(led,HIGH);
delay(200);
digitalWrite(beep,HIGH);
digitalWrite(led,LOW);
delay(200);
}
delay(2000);
for(int b=0;b<3;b++)
{
digitalWrite(beep,LOW);
digitalWrite(led,HIGH);
delay(1000);
digitalWrite(beep,HIGH);
digitalWrite(led,LOW);
delay(1000);
}
for(int b=0;b<3;b++)
{
digitalWrite(beep,LOW);
digitalWrite(led,HIGH);
delay(200);
digitalWrite(beep,HIGH);
digitalWrite(led,LOW);
delay(200);
}
delay(2000);
}

三、效果

请添加图片描述

评论